package com.example.daydayup.controller;

import com.example.daydayup.utils.RedisUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: wzj
 * @Date: 2024/5/8 14:30
 */
@RequiredArgsConstructor
@RestController
@RequestMapping("/joven")
public class HelloController {

    private final RedisUtil redisUtil;

    @GetMapping("/hello")
    public String test(String name) {
        return "hello: " + name;
    }


    @GetMapping("/set")
    public boolean setKey(String name, String value) {
        return redisUtil.set(name, value);
    }

    @GetMapping("/get")
    public Object getKey(String name) {
        return redisUtil.get(name);
    }
}
